package com.wing.device.model.entity;

import java.io.Serializable;
import java.time.LocalDateTime;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * 设备表
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("dev_device")
public class Device extends BaseEntity<Device> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum Status implements IEnum<Integer> {

        /**
         * 设备正常
         */
        normalUse(0, "设备正常"),
        /**
         * 设备异常
         */
        exception(1, "设备异常");

        private int code;
        private String desc;

        Status(int code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        @Override
        public Integer getValue() {
            return this.code;
        }

        public String getDesc() {
            return this.desc;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 设备名称
     */
    private String name;

    /**
     * 设备分类
     */
    private Long categoryId;

    /**
     * 设备类型
     */
    private Long deviceType;

    /**
     * 排序
     */
    private Integer sortNumber;

    /**
     * 设备品牌ID
     */
    private Long deviceBrandId;

    private String deviceBrandName;

    /**
     * 设备型号ID
     */
    private Long deviceModelId;

    /**
     * 设备编码
     */
    private String deviceCode;

    /**
     * 设备照片
     */
    private String devicePic;

    /**
     * 设备加工工艺ID
     */
    private Long workmanshipId;

    /**
     * 可加工材料ID
     */
    private Long canMachinableMaterialsId;

    /**
     * 设备厂家
     */
    private String factoryName;

    /**
     * 供应商名称
     */
    private String supplierName;

    /**
     * 设备状态
     */
    private Status status;

    /**
     * 设备状态描述
     */
    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        return status == null ? null : status.getDesc();
    }

    /**
     * 供应商网址
     */
    private String supplierUrl;

    /**
     * 采购合同
     */
    private String contractOfPurchase;

    /**
     * 供应商电话
     */
    private String supplierPhone;

    /**
     * 供应商地址
     */
    private String supplierAddress;


    /**
     * 供应商联系
     */
    private String supplierContact;

    private Integer supplierContactId;

    /**
     * 车间id
     */
    private Long workshopId;

    /**
     * 供应商id
     */
    private Long supplierId;

    /**
     * 企业ID
     */
    private Long companyInfoId;

    /**
     * 部门ID
     */
    private Long departmentId;
    /**
     * 资产编号
     */
    private String propertyCode;
    private String companyInfoName;

    /**
     * 设备价格
     */
    private Double devicePrice;

    /**
     * 折旧时间
     */
    private LocalDateTime depreciationTime;

    /**
     * 折旧价
     */
    private Double depreciationPrice;

    /**
     * 折旧时长
     */
    private Integer depreciationDuration;

    private LocalDateTime inspectTime;
    private LocalDateTime inspectNextTime;
    private Integer inspectCycle;
    private LocalDateTime maintenanceTime;
    private LocalDateTime maintenanceNextTime;
    private Integer maintenanceCycle;

    /**
     * 设备SOP资料
     */
    private String referenceUrl;
    /**
     * 设备操作说明
     */
    private String directionUrl;
    /**
     * 其他附件资料
     */
    private String otherUrl;

    private String deviceAppendix;

    private String faceCode;

    private String deviceMent;
}
